package com.yanqu.road.server.cmd.activity.chinesechess;

import com.yanqu.road.pb.activity.ChineseChessProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.chess.ChineseChessModule;
import com.yanqu.road.server.manger.activity.chinesechess.ChineseChessMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CHINESECHESS_GAME_DEBUG, desc = "")
public class ChineseChessDebugCmd extends AbstractCommand {

    private int activityId;
    private int gameNo;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ChineseChessProto.ChineseChessGameDebugReqMsg reqMsg = ChineseChessProto.ChineseChessGameDebugReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        gameNo = reqMsg.getGameNo();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        //策划调试数值自动下棋模拟玩家
        /*if(ChineseChessMgr.getShowTimeActivityId() == 0 || ChineseChessMgr.getShowTimeActivityId() != activityId){
            ret = GameErrorCode.E_ACTIVITY_NO_FOUND;
            return;
        }
        player.getModule(ChineseChessModule.class).debugAutoMove();*/
    }

    @Override
    public void sendData(GamePlayer player) {
        if(ret != 0){
            ChineseChessProto.ChineseChessGameDebugRespMsg.Builder respMsg = ChineseChessProto.ChineseChessGameDebugRespMsg.newBuilder();
            respMsg.setRet(ret);
            player.sendPacket(Protocol.U_CHINESECHESS_GAME_DEBUG, respMsg);
        }
    }
}
